
clear;
load('CSPMatrix');
load('SVMmodel');


t = tcpip('10.141.101.6',8888); 


fopen(t);

% fwrite(t,'1');
% A = fread(t,1);
% f = char(A);
% rec = str2double(f);
rec = 0;
i = 0;
while(1)
    if(rec == 1)
        break;
    end
    if(t.BytesAvailable)
        A = fread(t,1);
        f = char(A);
        rec = str2double(f);
        [eegData,priLabel] = onlinePro(CSPMatrix,model);
        fwrite(t,num2str(priLabel));
        b = ['b',num2str(i)];
        eval([b,'=eegData;']);
        i = i+1;
        
    end          
end


    




